//
//  RTUerInfoController.m
//  RBToyAPI
//
//  Created by baxiang on 2018/2/1.
//  Copyright © 2018年 roobo. All rights reserved.
//

#import "RTUerSettingController.h"
#import "RTDetailInfoTableCell.h"
@interface RTUerSettingController ()

@end

@implementation RTUerSettingController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.tableView registerClass:[RTDetailInfoTableCell class] forCellReuseIdentifier:NSStringFromClass([RTDetailInfoTableCell class])];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 2;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 50;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    RTDetailInfoTableCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([RTDetailInfoTableCell class]) forIndexPath:indexPath];
    if (indexPath.row == 0) {
        cell.namelab.text = @"修改用户昵称";
     
    }else if (indexPath.row == 1){
        cell.namelab.text = @"获取宝宝信息";
      
    }
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        [RBUserApi updateNickname:@"Test user" block:^(BOOL isSuccess, NSError * _Nonnull error) {
            
        }];
    }else if (indexPath.row == 1){
        [RBUserApi getBabyList:^(NSArray<RBBabyModel *> * _Nonnull babyModels, NSError * _Nonnull error) {
            
        }];
    }else if (indexPath.row == 2){
        [RBDeviceApi restartDevice:^(BOOL isSuccess, NSError * _Nonnull error) {
            
        }];
    }else if (indexPath.row == 3){
        [RBDeviceApi changeDeviceVolume:100 block:^(BOOL isSuccess, NSError * _Nullable error) {
            
        }];
    }
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
